<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/*
<span class='line'>  2</span>  * $Id: om-menu.js,v 1.41 2012/06/27 03:10:09 luoyegang Exp $
<span class='line'>  3</span>  * operamasks-ui om-menu.js @VERSION
<span class='line'>  4</span>  *
<span class='line'>  5</span>  * Copyright 2011, AUTHORS.txt (http://ui.operamasks.org/about)
<span class='line'>  6</span>  * Dual licensed under the MIT or LGPL Version 2 licenses.
<span class='line'>  7</span>  * http://ui.operamasks.org/license
<span class='line'>  8</span>  *
<span class='line'>  9</span>  * http://ui.operamasks.org/docs/
<span class='line'> 10</span>  *
<span class='line'> 11</span>  * Depends:
<span class='line'> 12</span>  *	om-core.js
<span class='line'> 13</span>  */</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="PUNC">;</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 16</span>      * @name omMenu
<span class='line'> 17</span>      * @class menu组件。menu组件支持三种数据组织方式，分别为页面dom元素、json数据、url取值。&lt;br/>
<span class='line'> 18</span>      *        基本的json格式为{id:"",label:"",icon:"img/abc.png",seperator:true,disabled:true,children:[{},{}]},其中的id和label必须设置，&lt;br/>
<span class='line'> 19</span>      *        seperator为分割线，如果设置为true，则会在当前menuItem下面增加一条分割线。&lt;br/>&lt;br/>
<span class='line'> 20</span>      *        组件默认会处理的属性为上面列举的6个，即id、label、icon、seperator、disabled、children。&lt;br/>
<span class='line'> 21</span>      *        如果你自定义了某个属性，比如url，系统不会处理，它是在点击的时候交给onSelect方法处理，通过item.url获取url参数。
<span class='line'> 22</span>      * &lt;b>特点：&lt;/b>&lt;br/>
<span class='line'> 23</span>      * &lt;ol>
<span class='line'> 24</span>      *      &lt;li>支持icon自定制&lt;/li>
<span class='line'> 25</span>      *      &lt;li>灵活的事件处理机制，自由增加json属性，事件执行时获取数据进行处理&lt;/li>
<span class='line'> 26</span>      *      &lt;li>支持动态改变menuItem的disabled属性&lt;/li>
<span class='line'> 27</span>      *      &lt;li>支持右键菜单，无需指定位置，自动定位&lt;/li>
<span class='line'> 28</span>      *      &lt;li>支持菜单分组，使用showSeparator属性配置&lt;/li>
<span class='line'> 29</span>      * &lt;/ol>
<span class='line'> 30</span>      * 
<span class='line'> 31</span>      * &lt;b>示例：&lt;/b>&lt;br/>
<span class='line'> 32</span>      * &lt;pre>
<span class='line'> 33</span>      * &lt;script type="text/javascript" &gt;
<span class='line'> 34</span>      * $(document).ready(function() {
<span class='line'> 35</span>      *      //menu定义
<span class='line'> 36</span>      *      $('#contextMenu').omMenu({
<span class='line'> 37</span>      *          contextMenu : true,
<span class='line'> 38</span>      *          dataSource : '../../omMenu.json'
<span class='line'> 39</span>      *      });
<span class='line'> 40</span>      *      //显示menu菜单
<span class='line'> 41</span>      *      $('#contextMenu_test').bind('contextmenu',function(e){
<span class='line'> 42</span>      *           $('#contextMenu').omMenu('show',e);
<span class='line'> 43</span>      *      });
<span class='line'> 44</span>      * });
<span class='line'> 45</span>      * &lt;/script&gt;
<span class='line'> 46</span>      * &lt;/pre>
<span class='line'> 47</span>      * 
<span class='line'> 48</span>      * @constructor
<span class='line'> 49</span>      * @description 构造函数. 
<span class='line'> 50</span>      * @param p 标准config对象：{}
<span class='line'> 51</span>      */</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">    </span><span class="NAME">$.omWidget</span><span class="PUNC">(</span><span class="STRN">'om.omMenu'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">        </span><span class="NAME">options</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">/**@lends omMenu# */</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'> 55</span>              * 是否为右键菜单
<span class='line'> 56</span>              * @type Boolean 
<span class='line'> 57</span>              * @default false
<span class='line'> 58</span>              * @example
<span class='line'> 59</span>              * $("#menu_1").omMenu({contextMenu:true});
<span class='line'> 60</span>              */</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">            </span><span class="NAME">contextMenu</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'> 64</span>              * 最大宽度，如果menuItem文字长度超出了最大宽度，将会隐藏，鼠标移动到上面会有全文提示
<span class='line'> 65</span>              * @type Number 
<span class='line'> 66</span>              * @default 200
<span class='line'> 67</span>              * @example
<span class='line'> 68</span>              * $("#menu_1").omMenu({maxWidth:150});
<span class='line'> 69</span>              */</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">            </span><span class="NAME">maxWidth</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">200</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'> 73</span>              * 最小宽度，如果menuItem文字长度少于minWidth，则将使用空白填充。
<span class='line'> 74</span>              * @type Number 
<span class='line'> 75</span>              * @default 100
<span class='line'> 76</span>              * @example
<span class='line'> 77</span>              * $("#menu_1").omMenu({minWidth:50});
<span class='line'> 78</span>              */</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">            </span><span class="NAME">minWidth</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">100</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'> 82</span>              * 数据源，可以设置为json数据，也可以是url，如果不设置则为local，默认使用页面的dom元素生成Menu
<span class='line'> 83</span>              * @type String 
<span class='line'> 84</span>              * @default local
<span class='line'> 85</span>              * @example
<span class='line'> 86</span>              * $("#menu_1").omMenu({dataSource:'menuData.json'});
<span class='line'> 87</span>              */</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">            </span><span class="NAME">dataSource</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'local'</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'> 91</span>              * 当点击选择menu的时候触发的事件，item包含当前menuItem的所有数据。
<span class='line'> 92</span>              * @name omMenu#onSelect
<span class='line'> 93</span>              * @event
<span class='line'> 94</span>              * @param item 当前menuItem的所有数据
<span class='line'> 95</span>              * @param event jQuery.Event对象
<span class='line'> 96</span>              * @type Function
<span class='line'> 97</span>              * @default 无
<span class='line'> 98</span>              * @example
<span class='line'> 99</span>              * $("#menu_1").omMenu({
<span class='line'>100</span>              *         onSelect:function(item,event){
<span class='line'>101</span>              *            location.href = item.url;
<span class='line'>102</span>              *         }
<span class='line'>103</span>              * });
<span class='line'>104</span>              */</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>108</span>          * 显示menu，menu不会自己显示，必须调用show方法才能显示
<span class='line'>109</span>          * @name omMenu#show
<span class='line'>110</span>          * @function
<span class='line'>111</span>          * @param triggerEle 触发显示事件的对象，如点击的button触发的就是button对象
<span class='line'>112</span>          * @example
<span class='line'>113</span>          * //通过点击button显示menu
<span class='line'>114</span>          *  $('#btn').click(function(){
<span class='line'>115</span>          *     $('#menu_simple').omMenu('show',this);
<span class='line'>116</span>          *});
<span class='line'>117</span>          */</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">        </span><span class="NAME">show</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">triggerEle</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>119</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">top</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">left</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>120</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">offSet</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">triggerEle</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>121</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">options.contextMenu</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>122</span> </span><span class="WHIT">                </span><span class="NAME">top</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">triggerEle.pageY</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT">                </span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">triggerEle.pageX</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>124</span> </span><span class="WHIT">                </span><span class="NAME">triggerEle.preventDefault</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">                </span><span class="NAME">triggerEle.stopPropagation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>126</span> </span><span class="WHIT">                </span><span class="NAME">triggerEle.cancelBubble</span><span class="PUNC">=</span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//IE</span><span class="WHIT">
<span class='line'>127</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>128</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">buttomWidth</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">triggerEle</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">css</span><span class="PUNC">(</span><span class="STRN">'borderBottomWidth'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="STRN">'px'</span><span class="PUNC">,</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT">                </span><span class="NAME">top</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">offSet.top</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">  </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">triggerEle</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">height</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">buttomWidth</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'NaN'</span><span class="PUNC">?</span><span class="NAME">buttomWidth</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//1px作为调节距离</span><span class="WHIT">
<span class='line'>130</span> </span><span class="WHIT">                </span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">offSet.left</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">  </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>131</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">parent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>133</span> </span><span class="WHIT">            </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">parent.css</span><span class="PUNC">(</span><span class="STRN">'position'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'static'</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">parent</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">nodeName</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'BODY'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>134</span> </span><span class="WHIT">                </span><span class="NAME">parent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parent.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>135</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>136</span> </span><span class="WHIT">            </span><span class="NAME">top</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parent.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">top</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">            </span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="PUNC">=</span><span class="NAME">parent.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">element.outerWidth</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">document.documentElement.clientWidth</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">//当右边距离过短的时候会将提示框调整到左边</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">                </span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">element.outerWidth</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">20</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">css</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">"top"</span><span class="PUNC">:</span><span class="NAME">top</span><span class="PUNC">,</span><span class="STRN">'left'</span><span class="PUNC">:</span><span class="NAME">left</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>143</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">(</span><span class="STRN">"ul.om-menu"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">width</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">*</span><span class="NUMB">0.7</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>145</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">(</span><span class="STRN">"ul.om-menu"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"span:first"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="STRN">'om-menu-item-sep'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">   </span><span class="COMM">//TODO hasClass直接导致IE9使用MaxWidth</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">                    </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"span:first"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="STRN">'98%'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//分隔条宽度</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>149</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"span:first"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">width</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT">                        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"span:first"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'aria-haspopup'</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">width</span><span class="PUNC">-</span><span class="NUMB">15</span><span class="PUNC">:</span><span class="NAME">width</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//去掉icon的padding</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>157</span>          * 隐藏menu，隐藏之后会清空menu当前的状态。
<span class='line'>158</span>          * @name omMenu#hide
<span class='line'>159</span>          * @function
<span class='line'>160</span>          * @example
<span class='line'>161</span>          * //调用hide方法
<span class='line'>162</span>          *  $('#btn').click(function(){
<span class='line'>163</span>          *     $('#menu_simple').omMenu('hide');
<span class='line'>164</span>          *});
<span class='line'>165</span>          */</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">        </span><span class="NAME">hide</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">            </span><span class="NAME">this._hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>168</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>169</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>171</span>          * 将某个menuitem设置为disabled，设置之后menuitem将不会触发事件，如果有子菜单将不能打开子菜单，必须有menuItem。
<span class='line'>172</span>          * @name omMenu#disableItem
<span class='line'>173</span>          * @function
<span class='line'>174</span>          * @param itemId menuItem的ID
<span class='line'>175</span>          * @example
<span class='line'>176</span>          * //调用disableItem方法
<span class='line'>177</span>          *  $('#btn').click(function(){
<span class='line'>178</span>          *     $('#menu_simple').omMenu('disableItem','001');
<span class='line'>179</span>          *});
<span class='line'>180</span>          */</span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT">        </span><span class="NAME">disableItem</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">itemId</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>182</span> </span><span class="WHIT">            </span><span class="NAME">this.element.find</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">+</span><span class="NAME">itemId</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>183</span> </span><span class="WHIT">                        </span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"om-state-disabled"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>184</span> </span><span class="WHIT">                        </span><span class="PUNC">.</span><span class="NAME">unbind</span><span class="PUNC">(</span><span class="STRN">".menuItem"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>185</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>186</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>187</span>          * 将某个menuitem设置为enable。
<span class='line'>188</span>          * @name omMenu#enableItem
<span class='line'>189</span>          * @function
<span class='line'>190</span>          * @param itemId menuItem的ID
<span class='line'>191</span>          * @example
<span class='line'>192</span>          * //调用enableItem方法
<span class='line'>193</span>          *  $('#btn').click(function(){
<span class='line'>194</span>          *     $('#menu_simple').omMenu('enableItem','001');
<span class='line'>195</span>          *});
<span class='line'>196</span>          */</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT">        </span><span class="NAME">enableItem</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">itemId</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cli</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">+</span><span class="NAME">itemId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">                </span><span class="NAME">cli.removeClass</span><span class="PUNC">(</span><span class="STRN">"om-state-disabled"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT">                </span><span class="NAME">self._bindLiEvent</span><span class="PUNC">(</span><span class="NAME">cli</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>203</span> </span><span class="WHIT">        </span><span class="NAME">destroy</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT">        	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$doc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">document</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>205</span> </span><span class="WHIT">        		</span><span class="NAME">handler</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>206</span> </span><span class="WHIT">        	</span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">handler</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.globalEvent.pop</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>207</span> </span><span class="WHIT">        		</span><span class="NAME">$doc.unbind</span><span class="PUNC">(</span><span class="STRN">".omMenu"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">handler</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>208</span> </span><span class="WHIT">        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>209</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT">        </span><span class="NAME">_create</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>211</span> </span><span class="WHIT">            </span><span class="COMM">// omMenu 对 options 重设置支持不够全面，实际上也无多大必要</span><span class="WHIT">
<span class='line'>212</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT">                </span><span class="NAME">$ele</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT">                </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.dataSource</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>215</span> </span><span class="WHIT">            </span><span class="NAME">$ele.addClass</span><span class="PUNC">(</span><span class="STRN">'om-menu-container om-menu-content om-corner-all'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT">            </span><span class="NAME">$ele.css</span><span class="PUNC">(</span><span class="STRN">'position'</span><span class="PUNC">,</span><span class="STRN">'absolute'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'local'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT">                     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT">                         </span><span class="NAME">self._ajaxLoad</span><span class="PUNC">(</span><span class="NAME">$ele</span><span class="PUNC">,</span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT">                     </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT">                         </span><span class="NAME">$ele.append</span><span class="PUNC">(</span><span class="NAME">self._appendNodes.apply</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">source</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT">                         </span><span class="NAME">self._bindEvent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT">                     </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>225</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>226</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">firstMenu</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$ele.children</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"om-menu"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>227</span> </span><span class="WHIT">                    </span><span class="NAME">self._parseDomMenu</span><span class="PUNC">(</span><span class="NAME">firstMenu</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT">                    </span><span class="NAME">self._bindEvent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>229</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT">             </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>233</span> </span><span class="WHIT">        </span><span class="NAME">_init</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>234</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">opts</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>235</span> </span><span class="WHIT">                </span><span class="NAME">$ele</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>236</span> </span><span class="WHIT">            </span><span class="NAME">$ele.css</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">"minWidth"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">opts.minWidth</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">,</span><span class="STRN">"maxWidth"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">opts.maxWidth</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>237</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$.browser.msie</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">$.browser.version</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'6.0'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT">                </span><span class="NAME">$ele.css</span><span class="PUNC">(</span><span class="STRN">"width"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opts.minWidth</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">30</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>239</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$.browser.msie</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">$.browser.version</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'7.0'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT">                </span><span class="NAME">$ele.css</span><span class="PUNC">(</span><span class="STRN">"width"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">opts.maxWidth</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>242</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>243</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>244</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT">        </span><span class="NAME">_ajaxLoad</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT">             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>247</span> </span><span class="WHIT">             </span><span class="NAME">$.ajax</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT">                 </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>249</span> </span><span class="WHIT">                 </span><span class="NAME">method</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'POST'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>250</span> </span><span class="WHIT">                 </span><span class="NAME">dataType</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'json'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT">                 </span><span class="NAME">success</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT">                     </span><span class="NAME">target.append</span><span class="PUNC">(</span><span class="NAME">self._appendNodes.apply</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">data</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>253</span> </span><span class="WHIT">                     </span><span class="NAME">self._bindEvent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>254</span> </span><span class="WHIT">                 </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>255</span> </span><span class="WHIT">             </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>256</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>257</span> </span><span class="WHIT">        </span><span class="NAME">_appendNodes</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">,</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>258</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">menuHtml</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>259</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ulClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="STRN">"om-menu"</span><span class="PUNC">:</span><span class="STRN">"om-menu-content"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>260</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">display</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="STRN">"block"</span><span class="PUNC">:</span><span class="STRN">"none"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>261</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">imgClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="STRN">"om-menu-icon"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"om-menu-icon om-menu-icon-child"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT">            </span><span class="NAME">menuHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;ul class=\""</span><span class="PUNC">+</span><span class="NAME">ulClass</span><span class="PUNC">+</span><span class="STRN">" om-corner-all\" style=\"display:"</span><span class="PUNC">+</span><span class="NAME">display</span><span class="PUNC">+</span><span class="STRN">";\">"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">childrenHtml</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">item.children</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">item.disabled</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">item.disabled</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"true"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT">                            </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;li id=\""</span><span class="PUNC">+</span><span class="NAME">item.id</span><span class="PUNC">+</span><span class="STRN">"\" aria-haspopup=\"true\"  class=\"om-state-disabled\">"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>268</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>269</span> </span><span class="WHIT">                            </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;li id=\""</span><span class="PUNC">+</span><span class="NAME">item.id</span><span class="PUNC">+</span><span class="STRN">"\"  aria-haspopup=\"true\">"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>270</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT">                        </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;a href=\"javascript:void(0)\" class=\"om-corner-all om-menu-indicator\">"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>272</span> </span><span class="WHIT">                        </span><span class="NAME">item.icon</span><span class="PUNC">?</span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;img class=\""</span><span class="PUNC">+</span><span class="NAME">imgClass</span><span class="PUNC">+</span><span class="STRN">"\" src=\""</span><span class="PUNC">+</span><span class="NAME">item.icon</span><span class="PUNC">+</span><span class="STRN">"\">"</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>273</span> </span><span class="WHIT">                        </span><span class="NAME">item.icon</span><span class="PUNC">?</span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;span>"</span><span class="PUNC">+</span><span class="NAME">item.label</span><span class="PUNC">+</span><span class="STRN">"&lt;/span>"</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;span style=\"margin-left:2em;\">"</span><span class="PUNC">+</span><span class="NAME">item.label</span><span class="PUNC">+</span><span class="STRN">"&lt;/span>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>274</span> </span><span class="WHIT">                        </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;span class=\"ui-icon-span\" role=\"popup\">&lt;/span>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>275</span> </span><span class="WHIT">                        </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;/a>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>276</span> </span><span class="WHIT">                        </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="NAME">self._appendNodes</span><span class="PUNC">(</span><span class="NAME">item.children</span><span class="PUNC">,</span><span class="NAME">index</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>277</span> </span><span class="WHIT">                        </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;/li>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>278</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>279</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">item.disabled</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">item.disabled</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"true"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>280</span> </span><span class="WHIT">                            </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;li id=\""</span><span class="PUNC">+</span><span class="NAME">item.id</span><span class="PUNC">+</span><span class="STRN">"\"  class=\"om-state-disabled\">"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>281</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>282</span> </span><span class="WHIT">                            </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;li id=\""</span><span class="PUNC">+</span><span class="NAME">item.id</span><span class="PUNC">+</span><span class="STRN">"\" >"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>283</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>284</span> </span><span class="WHIT">                        </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;a href=\"javascript:void(0)\" class=\"om-corner-all om-menu-indicator\">"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>285</span> </span><span class="WHIT">                        </span><span class="NAME">item.icon</span><span class="PUNC">?</span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;img class=\""</span><span class="PUNC">+</span><span class="NAME">imgClass</span><span class="PUNC">+</span><span class="STRN">"\" src=\""</span><span class="PUNC">+</span><span class="NAME">item.icon</span><span class="PUNC">+</span><span class="STRN">"\">"</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>286</span> </span><span class="WHIT">                        </span><span class="NAME">item.icon</span><span class="PUNC">?</span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;span>"</span><span class="PUNC">+</span><span class="NAME">item.label</span><span class="PUNC">+</span><span class="STRN">"&lt;/span>"</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;span style=\"margin-left:2em;\">"</span><span class="PUNC">+</span><span class="NAME">item.label</span><span class="PUNC">+</span><span class="STRN">"&lt;/span>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT">                        </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;/a>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>288</span> </span><span class="WHIT">                        </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;/li>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>289</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>290</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">item.seperator</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"true"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">item.seperator</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>291</span> </span><span class="WHIT">                        </span><span class="NAME">childrenHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;li class=\"om-menu-sep-li\"  >&lt;span class=\"om-menu-item-sep\">&nbsp;&lt;/span>&lt;/li>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>292</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>293</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">li</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">self.element</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'id'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"_"</span><span class="PUNC">+</span><span class="NAME">item.id</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>294</span> </span><span class="WHIT">                    </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">self.element</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">data</span><span class="PUNC">(</span><span class="NAME">li</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT">            </span><span class="NAME">menuHtml.push</span><span class="PUNC">(</span><span class="NAME">childrenHtml.join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT">            </span><span class="NAME">menuHtml.push</span><span class="PUNC">(</span><span class="STRN">"&lt;/ul>"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">menuHtml.join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>299</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>300</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>301</span> </span><span class="WHIT">        </span><span class="COMM">//处理页面编写dom节点的情况</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT">        </span><span class="NAME">_parseDomMenu</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">element.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"aria-haspopup"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"true"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">//判断是否为第一帧</span><span class="WHIT">
<span class='line'>304</span> </span><span class="WHIT">                </span><span class="NAME">element.addClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-content om-corner-all"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>305</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>306</span> </span><span class="WHIT">            </span><span class="NAME">element.css</span><span class="PUNC">(</span><span class="STRN">'display'</span><span class="PUNC">,</span><span class="STRN">'none'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">lis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>308</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">lis.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>309</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">li</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">lis</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">liCul</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">li.children</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>310</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">liCul.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>311</span> </span><span class="WHIT">                    </span><span class="NAME">li.attr</span><span class="PUNC">(</span><span class="STRN">"aria-haspopup"</span><span class="PUNC">,</span><span class="STRN">"true"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>312</span> </span><span class="WHIT">                    </span><span class="NAME">li.find</span><span class="PUNC">(</span><span class="STRN">"span[role='popup']"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"ui-icon-span"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>313</span> </span><span class="WHIT">                    </span><span class="NAME">this._parseDomMenu</span><span class="PUNC">(</span><span class="NAME">liCul</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>314</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT">                </span><span class="NAME">li.find</span><span class="PUNC">(</span><span class="STRN">"a"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"om-corner-all om-menu-indicator"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT">                </span><span class="NAME">li.find</span><span class="PUNC">(</span><span class="STRN">"img"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-icon"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT">        </span><span class="NAME">_showChildren</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>320</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>321</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">li</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">li.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>322</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">li_child_ul</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">li.children</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">eq</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>323</span> </span><span class="WHIT">                </span><span class="NAME">li_child_ul.css</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">"minWidth"</span><span class="PUNC">:</span><span class="NAME">this.options.minWidth</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"top"</span><span class="PUNC">:</span><span class="NAME">li.position</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">top</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>324</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">li.width</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>325</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NUMB">2</span><span class="PUNC">*</span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">li.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">document.documentElement.clientWidth</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">//当右边距离过短的时候会将提示框调整到左边</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT">                    </span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">left</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>327</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>328</span> </span><span class="WHIT">                </span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT">                </span><span class="NAME">li_child_ul.css</span><span class="PUNC">(</span><span class="STRN">"left"</span><span class="PUNC">,</span><span class="NAME">left</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT">                </span><span class="NAME">li_child_ul.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT">                </span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT">                </span><span class="NAME">li_child_ul.children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"span:first"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="STRN">'om-menu-item-sep'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT">                        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"span:first"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="STRN">'98%'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//分隔条宽度</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">li_child_ul.width</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">self.options.maxWidth</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT">                            </span><span class="NAME">li_child_ul.width</span><span class="PUNC">(</span><span class="NAME">self.options.maxWidth</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>338</span> </span><span class="WHIT">                            </span><span class="NAME">width</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options.maxWidth</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NUMB">0.6</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>339</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>340</span> </span><span class="WHIT">                        	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">li_child_ul.attr</span><span class="PUNC">(</span><span class="STRN">'hasShow'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>341</span> </span><span class="WHIT">                        		</span><span class="NAME">li_child_ul.width</span><span class="PUNC">(</span><span class="NAME">li_child_ul.find</span><span class="PUNC">(</span><span class="STRN">'li:eq(0)>a:eq(0)'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NUMB">15</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>342</span> </span><span class="WHIT">                        		</span><span class="NAME">li_child_ul.attr</span><span class="PUNC">(</span><span class="STRN">'hasShow'</span><span class="PUNC">,</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>343</span> </span><span class="WHIT">                        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>344</span> </span><span class="WHIT">                            </span><span class="NAME">width</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">li_child_ul.width</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NUMB">0.6</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>345</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>346</span> </span><span class="WHIT">                        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"span:first"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="NAME">width</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>347</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>348</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>349</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>351</span> </span><span class="WHIT">        </span><span class="NAME">_hideChildren</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>352</span> </span><span class="WHIT">            </span><span class="NAME">li.children</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">eq</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>353</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>354</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>355</span> </span><span class="WHIT">        </span><span class="NAME">_bindLiEvent</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>356</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.options</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>357</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">li</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">"mouseenter.menuItem"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>358</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self_li</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>359</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">width</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self_li.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>360</span> </span><span class="WHIT">                </span><span class="NAME">self_li.addClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>361</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$.browser.msie</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">$.browser.version</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'9.0'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">//解决bug AOM-576</span><span class="WHIT">
<span class='line'>362</span> </span><span class="WHIT">                	</span><span class="NAME">self_li.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="NAME">width</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>363</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>364</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">self_li.attr</span><span class="PUNC">(</span><span class="STRN">"aria-haspopup"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>365</span> </span><span class="WHIT">                    </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>366</span> </span><span class="WHIT">                        </span><span class="NAME">self._showChildren</span><span class="PUNC">(</span><span class="NAME">self_li</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>367</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NUMB">200</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>368</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>369</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">"mouseleave.menuItem"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>370</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self_li</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>371</span> </span><span class="WHIT">                </span><span class="NAME">self_li.removeClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>372</span> </span><span class="WHIT">                </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>373</span> </span><span class="WHIT">                    </span><span class="NAME">self_li.children</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>374</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NUMB">200</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>375</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">"mousedown.menuItem"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>376</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">data</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">"_"</span><span class="PUNC">+</span><span class="NAME">this.id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>377</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">options.onSelect</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>378</span> </span><span class="WHIT">                	</span><span class="NAME">self._trigger</span><span class="PUNC">(</span><span class="STRN">"onSelect"</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">,</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>379</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>380</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>381</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>382</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>383</span> </span><span class="WHIT">        </span><span class="NAME">_bindEvent</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>384</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>385</span> </span><span class="WHIT">            	</span><span class="NAME">uls</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>386</span> </span><span class="WHIT">            	</span><span class="NAME">lis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>387</span> </span><span class="WHIT">            	</span><span class="NAME">$doc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">document</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>388</span> </span><span class="WHIT">            	</span><span class="NAME">tempEvent</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>389</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">lis.length</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>390</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">lis</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="STRN">"om-state-disabled"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>391</span> </span><span class="WHIT">                   </span><span class="NAME">self._bindLiEvent</span><span class="PUNC">(</span><span class="NAME">lis</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>392</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>393</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>394</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">&lt;</span><span class="NAME">uls.length</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>395</span> </span><span class="WHIT">                </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">uls</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">"mouseleave.menuContainer"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>396</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ul</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>397</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ul.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">"aria-haspopup"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"true"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>398</span> </span><span class="WHIT">                        </span><span class="NAME">ul.hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>399</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>400</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>401</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>402</span> </span><span class="WHIT">            </span><span class="NAME">this.globalEvent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>403</span> </span><span class="WHIT">            </span><span class="NAME">$doc.bind</span><span class="PUNC">(</span><span class="STRN">'mousedown.omMenu'</span><span class="PUNC">,</span><span class="NAME">tempEvent</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>404</span> </span><span class="WHIT">                </span><span class="NAME">self._hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>405</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>406</span> </span><span class="WHIT">            </span><span class="NAME">this.globalEvent.push</span><span class="PUNC">(</span><span class="NAME">tempEvent</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>407</span> </span><span class="WHIT">            </span><span class="NAME">$doc.bind</span><span class="PUNC">(</span><span class="STRN">'keyup.omMenu'</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tempEvent</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>408</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.keyCode</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>409</span> </span><span class="WHIT">                    </span><span class="NAME">keyEnum</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.om.keyCode</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>410</span> </span><span class="WHIT">                </span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>411</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyEnum.DOWN</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">//down</span><span class="WHIT">
<span class='line'>412</span> </span><span class="WHIT">                    </span><span class="NAME">self._selectNext</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>413</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>414</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyEnum.UP</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">//up</span><span class="WHIT">
<span class='line'>415</span> </span><span class="WHIT">                    </span><span class="NAME">self._selectPrev</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>416</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>417</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyEnum.LEFT</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">//left</span><span class="WHIT">
<span class='line'>418</span> </span><span class="WHIT">                    </span><span class="NAME">self._hideRight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>419</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>420</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyEnum.RIGHT</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">//right</span><span class="WHIT">
<span class='line'>421</span> </span><span class="WHIT">                    </span><span class="NAME">self._showRight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>422</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>423</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyEnum.ENTER</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">//enter 建立在当前menu就是打开的menu前提下</span><span class="WHIT">
<span class='line'>424</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">element.css</span><span class="PUNC">(</span><span class="STRN">"display"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"block"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>425</span> </span><span class="WHIT">                        </span><span class="NAME">self._backfill</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>426</span> </span><span class="WHIT">                    	</span><span class="NAME">self._hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>427</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>428</span> </span><span class="WHIT">                </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="NAME">keyEnum.ESCAPE</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">//esc</span><span class="WHIT">
<span class='line'>429</span> </span><span class="WHIT">                    </span><span class="NAME">self._hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>430</span> </span><span class="WHIT">                    </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>431</span> </span><span class="WHIT">                </span><span class="KEYW">default</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>432</span> </span><span class="WHIT">                   </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>433</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>434</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>435</span> </span><span class="WHIT">            </span><span class="NAME">this.globalEvent.push</span><span class="PUNC">(</span><span class="NAME">tempEvent</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>436</span> </span><span class="WHIT">            </span><span class="NAME">$doc.bind</span><span class="PUNC">(</span><span class="STRN">'keydown.omMenu'</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tempEvent</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="COMM">//fixed AOM-430</span><span class="WHIT">
<span class='line'>437</span> </span><span class="WHIT">            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">e.keyCode</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">37</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">e.keyCode</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NUMB">40</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>438</span> </span><span class="WHIT">            		</span><span class="NAME">e.preventDefault</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>439</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>440</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>441</span> </span><span class="WHIT">            </span><span class="NAME">this.globalEvent.push</span><span class="PUNC">(</span><span class="NAME">tempEvent</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>442</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>443</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>444</span> </span><span class="WHIT">        </span><span class="NAME">_hide</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>445</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>446</span> </span><span class="WHIT">            </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">css</span><span class="PUNC">(</span><span class="STRN">"display"</span><span class="PUNC">,</span><span class="STRN">"none"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>447</span> </span><span class="WHIT">            </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"li.om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>448</span> </span><span class="WHIT">                </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>449</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>450</span> </span><span class="WHIT">            </span><span class="NAME">element.hide</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>451</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>452</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>453</span>          * 排除掉分隔条的干扰，找到下一个menuItem
<span class='line'>454</span>          * 返回li
<span class='line'>455</span>          * @param liMenuItem
<span class='line'>456</span>          */</span><span class="WHIT">
<span class='line'>457</span> </span><span class="WHIT">        </span><span class="NAME">_findNext</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">liMenuItem</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>458</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">next</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>459</span> </span><span class="WHIT">                </span><span class="NAME">oldItem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">liMenuItem</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>460</span> </span><span class="WHIT">            </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">next</span><span class="PUNC">=</span><span class="NAME">liMenuItem.next</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>461</span> </span><span class="WHIT">            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">next.hasClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-sep-li"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">next.hasClass</span><span class="PUNC">(</span><span class="STRN">"om-state-disabled"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>462</span> </span><span class="WHIT">            		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">next</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>463</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>464</span> </span><span class="WHIT">            	</span><span class="NAME">liMenuItem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">next</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>465</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>466</span> </span><span class="WHIT">            </span><span class="COMM">//如果没有，则从上到下再找一遍</span><span class="WHIT">
<span class='line'>467</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oldItem.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"li:first"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>468</span> </span><span class="WHIT">            </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">item.length</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">oldItem</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>469</span> </span><span class="WHIT">            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">item.hasClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-sep-li"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">item.hasClass</span><span class="PUNC">(</span><span class="STRN">"om-state-disabled"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>470</span> </span><span class="WHIT">            		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>471</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>472</span> </span><span class="WHIT">            	</span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">item.next</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>473</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>474</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>475</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>476</span>          * 排除掉分隔条的干扰，找到前一个menuItem
<span class='line'>477</span>          * 返回li
<span class='line'>478</span>          * @param liMenuItem
<span class='line'>479</span>          */</span><span class="WHIT">
<span class='line'>480</span> </span><span class="WHIT">        </span><span class="NAME">_findPrev</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">liMenuItem</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>481</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prev</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>482</span> </span><span class="WHIT">            	</span><span class="NAME">oldItem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">liMenuItem</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>483</span> </span><span class="WHIT">            </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prev</span><span class="PUNC">=</span><span class="NAME">liMenuItem.prev</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>484</span> </span><span class="WHIT">            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">prev.hasClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-sep-li"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">prev.hasClass</span><span class="PUNC">(</span><span class="STRN">"om-state-disabled"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>485</span> </span><span class="WHIT">            		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">prev</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>486</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>487</span> </span><span class="WHIT">            	</span><span class="NAME">liMenuItem</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">prev</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>488</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>489</span> </span><span class="WHIT">            </span><span class="COMM">//如果没有，则从下往上再找一遍</span><span class="WHIT">
<span class='line'>490</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ulChildren</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oldItem.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>491</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="NAME">ulChildren.eq</span><span class="PUNC">(</span><span class="NAME">ulChildren.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>492</span> </span><span class="WHIT">            </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">item.length</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">oldItem</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>493</span> </span><span class="WHIT">            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">item.hasClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-sep-li"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">item.hasClass</span><span class="PUNC">(</span><span class="STRN">"om-state-disabled"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>494</span> </span><span class="WHIT">            		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>495</span> </span><span class="WHIT">            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>496</span> </span><span class="WHIT">            	</span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">item.prev</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>497</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>498</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>499</span> </span><span class="WHIT">        </span><span class="NAME">_selectNext</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>500</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="NAME">curLi</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>501</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">menuItemHover</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"li.om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>502</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hoverLast</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">menuItemHover.eq</span><span class="PUNC">(</span><span class="NAME">menuItemHover.length</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>503</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">menuItemHover.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">//如果没有被选中的就选中第一个</span><span class="WHIT">
<span class='line'>504</span> </span><span class="WHIT">                </span><span class="NAME">curLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">eq</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>505</span> </span><span class="WHIT">                </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">curLi.hasClass</span><span class="PUNC">(</span><span class="STRN">'om-state-disabled'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>506</span> </span><span class="WHIT">                    </span><span class="NAME">curLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">curLi.next</span><span class="PUNC">(</span><span class="STRN">'li'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>507</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>508</span> </span><span class="WHIT">                </span><span class="NAME">curLi.addClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>509</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>510</span> </span><span class="WHIT">                </span><span class="NAME">curLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._findNext</span><span class="PUNC">(</span><span class="NAME">hoverLast</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>511</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">curLi.length</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>512</span> </span><span class="WHIT">                </span><span class="NAME">curLi.addClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>513</span> </span><span class="WHIT">                </span><span class="NAME">hoverLast.removeClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>514</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>515</span> </span><span class="WHIT">            </span><span class="NAME">this._hideChildren</span><span class="PUNC">(</span><span class="NAME">hoverLast</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>516</span> </span><span class="WHIT">            </span><span class="NAME">this._showChildren</span><span class="PUNC">(</span><span class="NAME">curLi</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>517</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>518</span> </span><span class="WHIT">        </span><span class="NAME">_selectPrev</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>519</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">,</span><span class="NAME">curLi</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>520</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">menuItemHover</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"li.om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>521</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hoverLast</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">menuItemHover.eq</span><span class="PUNC">(</span><span class="NAME">menuItemHover.length</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>522</span> </span><span class="WHIT">                </span><span class="NAME">curLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"ul.om-menu > li"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>523</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">menuItemHover.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">//如果没有被选中的就选中最后一个</span><span class="WHIT">
<span class='line'>524</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">lastLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">curLi.eq</span><span class="PUNC">(</span><span class="NAME">curLi.length</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>525</span> </span><span class="WHIT">                </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">lastLi.hasClass</span><span class="PUNC">(</span><span class="STRN">'om-state-disabled'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>526</span> </span><span class="WHIT">                    </span><span class="NAME">lastLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">curLi.eq</span><span class="PUNC">(</span><span class="NAME">curLi.length</span><span class="PUNC">-</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>527</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>528</span> </span><span class="WHIT">                </span><span class="PUNC">(</span><span class="NAME">curLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">lastLi</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>529</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>530</span> </span><span class="WHIT">                </span><span class="NAME">curLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._findPrev</span><span class="PUNC">(</span><span class="NAME">hoverLast</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>531</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">curLi.length</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>532</span> </span><span class="WHIT">                </span><span class="NAME">curLi.addClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>533</span> </span><span class="WHIT">                </span><span class="NAME">hoverLast.removeClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>534</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>535</span> </span><span class="WHIT">            </span><span class="NAME">this._hideChildren</span><span class="PUNC">(</span><span class="NAME">hoverLast</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>536</span> </span><span class="WHIT">            </span><span class="NAME">this._showChildren</span><span class="PUNC">(</span><span class="NAME">curLi</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>537</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>538</span> </span><span class="WHIT">        </span><span class="NAME">_hideRight</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>539</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>540</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">currentA</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"li.om-menu-item-hover"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>541</span> </span><span class="WHIT">                </span><span class="NAME">hoverLast</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currentA.eq</span><span class="PUNC">(</span><span class="NAME">currentA.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>542</span> </span><span class="WHIT">            </span><span class="NAME">hoverLast.removeClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>543</span> </span><span class="WHIT">            </span><span class="NAME">self._hideChildren</span><span class="PUNC">(</span><span class="NAME">hoverLast</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>544</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>545</span> </span><span class="WHIT">        </span><span class="NAME">_showRight</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>546</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.element</span><span class="PUNC">,</span><span class="NAME">curLi</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>547</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">parentA</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"li.om-menu-item-hover"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>548</span> </span><span class="WHIT">                </span><span class="NAME">parentLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parentA.eq</span><span class="PUNC">(</span><span class="NAME">parentA.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>549</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">parentLi.attr</span><span class="PUNC">(</span><span class="STRN">"aria-haspopup"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"true"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>550</span> </span><span class="WHIT">                </span><span class="NAME">curLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">parentLi.children</span><span class="PUNC">(</span><span class="STRN">"ul"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">"li"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">eq</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>551</span> </span><span class="WHIT">                </span><span class="NAME">curLi.addClass</span><span class="PUNC">(</span><span class="STRN">"om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>552</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>553</span> </span><span class="WHIT">            </span><span class="NAME">self._showChildren</span><span class="PUNC">(</span><span class="NAME">curLi</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>554</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>555</span> </span><span class="WHIT">        </span><span class="NAME">_backfill</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>556</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">curas</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">element.find</span><span class="PUNC">(</span><span class="STRN">"li.om-menu-item-hover"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>557</span> </span><span class="WHIT">            </span><span class="NAME">curas.eq</span><span class="PUNC">(</span><span class="NAME">curas.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">mousedown</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>558</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>559</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>560</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="NAME">jQuery</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>